Output=ReadLn(TCP);IF File="0" THEN Call WriteLn(File,Output)
IF Word(Output,2)~="200" THEN Call CloseTCP("Error "Word(Output,2)", unable to grab dates information..")
i=0
DO UNTIL i=2|EOF(TCP)
Output=ReadLn(TCP);IF File="0" THEN Call WriteLn(File,Output)
IF Word(Output,1)="<SELECT" THEN i=i+1
End
IF EOF(TCP) THEN Call CloseTCP("Page layout has changed, please report this to trebs@ihug.com.au")
i=1;Output=ReadLn(TCP);IF File="0" THEN Call WriteLn(File,Output)
DayOpts="Please select one of the following:"NL
DO UNTIL Left(Output,9)="</SELECT>"|EOF(TCP)
Where=SubStr(Output,Pos(d2c(34),Output)+1)
Day.i=SubStr(Where,1,Pos(d2c(34),Where)-1)
DayOpts=DayOpts""NL""i". "Day.i
i=i+1;Output=ReadLn(TCP);IF File="0" THEN Call WriteLn(File,Output)
End
Amount=i-1
IF EOF(TCP) THEN Call CloseTCP("Page layout has changed, please report this to trebs@ihug.com.au")
Call Close(TCP);Call Close(File);SAY "Grabbed date information.."
NWorks.1="";NWorks.2="";NWorks.3=""
NWorks=rtgetstring("","Please select one of the following:"NL NL"1. Free to Air"NL"2. Foxtel"NL"3. Optus Television",Tag,"_Ok|_Cancel",Screen)
IF rtresult="0" THEN Exit;IF NWorks<1|NWorks>3 THEN Call CloseTCP("Invalid selection!")
NWorks.NWorks="on"
Loc=rtgetstring("","Please select one of the following:"NL NL"1. Adelaide"NL"2. SA Regional"NL"3. Brisbane"NL"4. QLD Regional"NL"5. Canberra"NL"6. Darwin"NL"7. NT Regional"NL"8. Hobart"NL"9. TAS Regional"NL"10. Melbourne"NL"11. VIC Regional"NL"12. Perth"NL"13. WA Regional"NL"14. Sydney"NL"15. NSW Regional",Tag,"_Ok|_Cancel",Screen)
IF rtresult="0" THEN Exit;IF Loc<1|Loc>15 THEN Call CloseTCP("Invalid selection!")
IF rtresult="0" THEN Exit;IF Day<1|Day>Amount THEN Call CloseTCP("Invalid selection!")
Day=Day.Day;Time=rtgetstring("","Please select one of the following:"NL NL"1. Morning"NL"2. Afternoon"NL"3. Night"NL"4. LateNight",Tag,"_Ok|_Cancel",Screen)
IF rtresult="0" THEN Exit;IF Time<1|Time>4 THEN Call CloseTCP("Invalid selection!")
Time.1="Morning";Time.2="Afternoon"
Time.3="Night";Time.4="LateNight"
Time=Time.Time
SAY "";SAY "Location = "Loc;SAY "Day = "Day
SAY "Time = "Time;SAY ""
SAY "Connecting to www.sofcom.com.au, please wait.."
IF ~Open(TCP,"TCP:www.sofcom.com.au/80","RW") THEN Call CloseTCP("Unable to connect, try again later..")